【ABAP系列】SAP ABAP WS_DELIVERY_UPDATE 修改数量、过账日期并发货过账

公众号:matinal
本文作者:matinal
 

 

前言部分

大家可以关注我的公众号,公众号里的排版更好,阅读更舒适。

正文部分

​
data: begin of i_vbkok occurs 11.
        include structure vbkok.
data: end of i_vbkok.

data: begin of i_vbpok_tab occurs 12.
        include structure vbpok.
data: end of i_vbpok_tab.

parameters: p_vbeln type vbeln.

data:g_likp like  likp.
data:g_lips like  lips.
data gv_14(14) type c.

start-of-selection.

  select single * into g_likp from likp
    where vbeln = p_vbeln.

  i_vbkok-vbeln_vl        = p_vbeln.        "Delivery number
  i_vbkok-wabuc           = 'X'.            "Automatic PGI
  i_vbkok-wadat_ist       = g_likp-bldat.
  append i_vbkok.

  select * into g_lips from lips
    where vbeln = p_vbeln.
    i_vbpok_tab-vbeln_vl    = p_vbeln.      "Delivery number
    i_vbpok_tab-posnr_vl    = g_lips-posnr.
    i_vbpok_tab-vbeln       = p_vbeln.
    i_vbpok_tab-posnn       = g_lips-posnr.
    i_vbpok_tab-matnr       = g_lips-matnr.
    gv_14                   = g_lips-lfimg.
    condense gv_14.
    i_vbpok_tab-pikmg       = gv_14 .
    append i_vbpok_tab.
  endselect.

  call function 'WS_DELIVERY_UPDATE'
    exporting
      vbkok_wa       = i_vbkok
      commit         = 'X'
      delivery       = p_vbeln
      update_picking = 'X'
    tables
      vbpok_tab      = i_vbpok_tab
    exceptions
      error_message  = 1
      others         = 2.
 

*---仅发货过账:

  report.

* Data Define
data: i_vbkok type vbkok.
data: begin of i_vbpok_tab occurs 12.
        include structure vbpok.
data: end of i_vbpok_tab.
data: p_vbeln type vbeln value '0080002730'.

*---交货抬头数据
i_vbkok-vbeln_vl        = p_vbeln.        "Delivery number
i_vbkok-wabuc           = 'X'.            "Automatic PGI
i_vbkok-wadat_ist       = '20110223'.

*---发货过账
call function 'WS_DELIVERY_UPDATE'
  exporting
    vbkok_wa       = i_vbkok
    commit         = 'X'
    delivery       = p_vbeln
    update_picking = 'X'
  exceptions
    error_message  = 1
    others         = 2.
if sy-subrc <> 0.
  write:/ '发货过账失败!'.
endif.

​

 

posted @ 2019-07-13 20:02  SAPmatinal  阅读(3977)  评论(0编辑  收藏  举报